package edu.zut.cn.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 *  资源拦截配置
 *
 * @author 张小訫
 */
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginHandlerInterceptor())
                .addPathPatterns("/**")
                //登录接口
                .excludePathPatterns("/login")
                //页面资源
                .excludePathPatterns("/")
                //验证码
                .excludePathPatterns("/captcha")
                //头像
                .excludePathPatterns("/avatar")
                //静态资源
                .excludePathPatterns("/favicon.ico")
                //swagger
                .excludePathPatterns("/swagger-ui.html")
                .excludePathPatterns("/swagger-resources/**")
                .excludePathPatterns("/v2/**")
                .excludePathPatterns("/webjars/**");

    }
}
